﻿using Shell.Library.Models.Interface;
using System;
using System.Windows.Input;
using Catel;

namespace Shell.Library.Models
{
    /// <summary>
    /// Represents a ribbon button
    /// </summary>
    public class RibbonButton : RibbonItemBase, IRibbonButton
    {
              public RibbonButton(string tabItemHeader, string groupBoxHeader, string itemHeader, ICommand command, RibbonBehavior behavior = RibbonBehavior.ActivateTab)
            : base(tabItemHeader, groupBoxHeader, itemHeader, behavior)
        {
            Argument.IsNotNullOrWhitespace("itemHeader", itemHeader);
            Argument.IsNotNull("command", command);

            Command = command;
        }

        public RibbonButton(string tabItemHeader, string groupBoxHeader, string itemHeader, string commandName, RibbonBehavior behavior = RibbonBehavior.ActivateTab)
            : base(tabItemHeader, groupBoxHeader, itemHeader, behavior)
        {
            Argument.IsNotNullOrWhitespace("itemHeader", itemHeader);
            Argument.IsNotNullOrWhitespace("commandName", commandName);

            CommandName = commandName;
        }

        /// <summary>
        /// Gets or sets the item image.
        /// </summary>
        /// <value>The item image.</value>
        public string ItemImage { get; set; }

        /// <summary>
        /// Gets the name of the command.
        /// <para />
        /// The <see cref="Command" /> property always is used first. If that value is <c>null</c>, this value will be used
        /// to bind the command to the active document.
        /// </summary>
        /// <value>The name of the command.</value>
        public string CommandName { get; private set; }

        /// <summary>
        /// Gets the command.
        /// <para />
        /// If this command is set, it will be used directly. Otherwise a binding to the active document will be created
        /// using the <see cref="CommandName" /> property.
        /// </summary>
        /// <value>The command.</value>
        public ICommand Command { get; private set; }
    }
}